using MediatR;
using Microsoft.AspNetCore.Mvc;
using RBAC.ErrorCode;
using RBAC.Write.Api.Application.Command.ERP.SalesManagement;

namespace RBAC.Write.Api.Controllers.ERP
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SalesOrderAuditController : ControllerBase
    {
        private readonly IMediator _mediator;

        public SalesOrderAuditController(IMediator mediator)
        {
            _mediator = mediator;
        }

        /// <summary>
        /// 1=审核，0=反审核，2=退回
        /// </summary>
        [HttpPost]
        public Task<APIResult<bool>> ApproveOrReturn([FromBody] ApproveOrReturnSalesOrderCommand request, CancellationToken cancellationToken)
        {
            return _mediator.Send(request, cancellationToken);
        }
    }
}
